home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / alib12 / ex01.exe / TEMPLATE.C < prev   
Text File  |  1991-08-06  |  1KB  |  57 lines

  1. /* template.c */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6.  
  7. #include "al.h"
  8.  
  9. /*****/
  10. void EveryChar(c)
  11. int c;
  12. /*****/
  13. {
  14.     /* Print each character received. */
  15.     printf("%c", c);
  16. }
  17.  
  18. /*****/
  19. void main(argc, argv)
  20. /*****/
  21. int argc;
  22. char *argv[];
  23. {
  24. int com;
  25. int err, add_info;
  26.  
  27.     argc = argc; /* for compiler. */
  28.     argv = argv; /* for compiler. */
  29.  
  30.     /* Initial AutoLibrary. */
  31.     AvidInitAutoLibrary(AVID, &add_info, "_B'3'");
  32.  
  33.     /* Open the communcation port. */
  34.     com = AvidOpenPort(AVID, "com1", &add_info, ".b'9600' .1 .8 .n +S -H");
  35.  
  36.     /* Display AutoLibrary version. */
  37.     AvidVersion(AVID, &add_info, "");
  38.  
  39.  
  40.     /* Ready for automation. */
  41.  
  42.     /* Do Hello World example as described in the Getting Started section
  43.        of the reference manual. */
  44.     AvidRegisterSend(AVID, com, "Hello World", &add_info, "");
  45.     AvidRegisterWait(AVID, com, 1, "Hello Back", &add_info, "");
  46.     if ((AvidSendSearch(AVID, com, (long)20, (long)120, &add_info, "")) == 1)
  47.     printf("Found Hello Back.\n");
  48.     else
  49.     printf("Timeout occurred.\n");
  50.  
  51.     /* Finished so close the com port. */
  52.     AvidClosePort(AVID, com, &add_info, "");
  53.  
  54.     /* Exit from AutoLibrary. */
  55.     AvidExitAutoLibrary(AVID, &add_info, "");
  56. }
  57.